<template>
    <div>
        <h3>添加会员等级</h3>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td align="right">会员等级</td>
                    <td><input type="text" v-model="queryInfo.Name"></td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td><input type="button" class="btn btn-primary" value="添加" @click="AddLevel"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue'
import axios from 'axios';

let queryInfo = reactive({
    "Name": ""
})

const AddLevel = () => {
    axios({
        method: 'post',
        url: '/api/Member/AddMemberLevel',
        data: queryInfo
    })
        .then(res => {
            if (res.data == -1) {
                alert("会员等级名称已存在")
            }
            else if (res.data > 0) {
                alert("添加成功")
            }
            else {
                alert("添加失败")
            }
            console.log(res);

        })
        .catch(err => {
            console.log(err);

        })
}

</script>

<style scoped></style>